#!/bin/bash
function Usage() {
    echo "Usage : $0"

}

if [[ $# -ge 1 ]];then
    Usage
    exit 1
fi

Nowtime=`date +"%Y-%m-%d %H:%M:%S"`
AllMem=`free -m | awk '{if($1 == "Mem:") {print $2}}'`
RemainMem=`free -m | awk '{if($1 == "Mem:") {print $7}}'`
UseMem=`free -m | awk '{if($1 == "Mem:") {print $3}}'`
UsePerc=`echo "scale=2; ${UseMem}/${AllMem}" | bc`
UsePerc=`printf "%.2f" ${UsePerc}`


echo "${Nowtime} ${AllMem}M ${RemainMem}M ${UsePerc}%"
